<link href="/static/css/plugins/chosen/bootstrap-chosen.css" rel="stylesheet">
<div class="row wrapper border-bottom white-bg page-heading">
    <div class="col-lg-10">
        <h2>网站设置</h2>
        <ol class="breadcrumb">
            <li class="breadcrumb-item">
                <a href="/">首页</a>
            </li>
            <li class="breadcrumb-item">
                <a href="/admin">后台</a>
            </li>
            <li class="breadcrumb-item active">
                <strong>网站设置</strong>
            </li>
        </ol>
    </div>
    <div class="col-lg-2">

    </div>
</div>
<div class="wrapper wrapper-content">
    <div class="row">
        <div class="col-lg-6">
            <div class="row">
                <div class="col-lg-12">
                    <div class="ibox ">
                        <div class="ibox-title">
                            <h5>网站配置
                            </h5>
                            <div class="ibox-tools">
                                <a class="collapse-link">
                                    <i class="fa fa-chevron-up"></i>
                                </a>
                                <a class="close-link">
                                    <i class="fa fa-times"></i>
                                </a>
                            </div>
                        </div>
                        <div class="ibox-content">
                            <div class="row">
                                <div class="col-sm-12 b-r">
                                    <p>网站全局配置.</p>
                                    <form role="form" id="form-site">
                                        <div class="form-group  row"><label class="col-sm-2 col-form-label">网站标题</label>

                                            <div class="col-sm-10"><input type="text" class="form-control"
                                                                          name="WebTitle"
                                                                          value="{{sc "WebTitle" ""}}">
                                            </div>
                                        </div>
                                        <div class="hr-line-dashed"></div>
                                        <div class="form-group row"><label
                                                    class="col-lg-2 col-form-label">网站LOGO</label>
                                            <div class="col-lg-10"><input type="text" placeholder="网站LOGO的资源地址"
                                                                          name="LogoUrl"
                                                                          class="form-control"
                                                                          value="{{sc "LogoUrl" ""}}">
                                            </div>
                                        </div>
                                        <div class="hr-line-dashed"></div>
                                        <div class="form-group row"><label class="col-sm-2 col-form-label">网站关键字</label>
                                            <div class="col-sm-10"><input type="text" class="form-control"
                                                                          name="Keywords"
                                                                          value="{{sc "Keywords" ""}}"> <span
                                                        class="form-text m-b-none">.</span>
                                            </div>
                                        </div>
                                        <div class="hr-line-dashed"></div>
                                        <div class="form-group row"><label class="col-sm-2 col-form-label">版权信息</label>

                                            <div class="col-sm-10"><input type="text" class="form-control"
                                                                          value="{{sc "CopyRight" ""}}"
                                                                          name="CopyRight">
                                            </div>
                                        </div>
                                        <div class="hr-line-dashed"></div>
                                        <div class="form-group row"><label class="col-lg-2 col-form-label">网站描述</label>

                                            <div class="col-lg-10"><textarea class="form-control" rows="3"
                                                                             name="Description">{{sc "Description" ""}}</textarea>
                                            </div>
                                        </div>
                                        <div class="hr-line-dashed"></div>
                                        <div class="form-group row">
                                            <div class="col-sm-4 col-sm-offset-2">
                                                <button class="btn btn-primary btn-sm" type="button" id="siteInfo">提交
                                                </button>
                                            </div>
                                        </div>
                                    </form>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="col-lg-12">
                    <div class="col-lg-12">
                        <div class="ibox ">
                            <div class="ibox-title">
                                <h5>阿里云OSS配置</h5>
                                <div class="ibox-tools">
                                    <a class="collapse-link">
                                        <i class="fa fa-chevron-up"></i>
                                    </a>
                                    <a class="close-link">
                                        <i class="fa fa-times"></i>
                                    </a>
                                </div>
                            </div>
                            <div class="ibox-content">
                                <form id="form-oss">
                                    <p>阿里云OSS配置，请确保密钥输入正确.Bucket ACL需修改为公共读 否则文件将无法访问</p>
                                    <div class="form-group row"><label class="col-lg-2 col-form-label">Bucket</label>
                                        <div class="col-lg-10"><input type="text" placeholder="填写存储空间名称"
                                                                      name="OssBucket"
                                                                      class="form-control"
                                                                      value="{{sc "OssBucket" "oss"}}">
                                        </div>
                                    </div>
                                    <div class="form-group row"><label class="col-lg-2 col-form-label">Accesskey</label>
                                        <div class="col-lg-10"><input type="text" placeholder="AccessKey ID"
                                                                      name="OssAk"
                                                                      class="form-control"
                                                                      value="{{sc "OssAk" "oss"}}">
                                        </div>
                                    </div>
                                    <div class="form-group row"><label class="col-lg-2 col-form-label">Secretkey</label>
                                        <div class="col-lg-10"><input type="password" placeholder="Access Key Secret"
                                                                      name="OssSk"
                                                                      class="form-control"
                                                                      value="{{sc "OssSk" "oss"}}">
                                        </div>
                                    </div>
                                    <div class="form-group row"><label
                                                class="col-lg-2 col-form-label">地域节点EndPoint</label>
                                        <div class="col-lg-10"><input type="text" placeholder="外网访问的地域节点"
                                                                      name="OssEndpoint"
                                                                      class="form-control"
                                                                      value="{{sc "OssEndpoint" "oss"}}">
                                        </div>
                                    </div>
                                    <div class="form-group row">
                                        <div class="col-lg-offset-2 col-lg-10">
                                            <button class="btn btn-sm btn-danger" type="button" id="ossInfo">修改
                                            </button>
                                        </div>
                                    </div>
                                </form>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="col-lg-12">
                    <div class="col-lg-12">
                        <div class="ibox ">
                            <div class="ibox-title">
                                <h5>腾讯云COS配置</h5>
                                <div class="ibox-tools">
                                    <a class="collapse-link">
                                        <i class="fa fa-chevron-up"></i>
                                    </a>
                                    <a class="close-link">
                                        <i class="fa fa-times"></i>
                                    </a>
                                </div>
                            </div>
                            <div class="ibox-content">
                                <form id="form-cos">
                                    <p>腾讯云COS配置，请确保密钥输入正确.Bucket ACL需修改为公共读 否则文件将无法访问</p>
                                    <div class="form-group row"><label class="col-lg-2 col-form-label">Bucket</label>
                                        <div class="col-lg-10"><input type="text" placeholder="填写存储空间名称"
                                                                      name="CosBucket"
                                                                      class="form-control"
                                                                      value="{{sc "CosBucket" "cos"}}">
                                        </div>
                                    </div>
                                    <div class="form-group row"><label class="col-lg-2 col-form-label">APPID</label>
                                        <div class="col-lg-10"><input type="text" placeholder="填写个人APPID"
                                                                      name="CosAppid"
                                                                      class="form-control"
                                                                      value="{{sc "CosAppid" "cos"}}">
                                        </div>
                                    </div>
                                    <div class="form-group row"><label class="col-lg-2 col-form-label">SecretID</label>
                                        <div class="col-lg-10"><input type="text" placeholder="SecretID"
                                                                      name="CosSkid"
                                                                      class="form-control"
                                                                      value="{{sc "CosSkid" "cos"}}">
                                        </div>
                                    </div>
                                    <div class="form-group row"><label class="col-lg-2 col-form-label">SecretKey</label>
                                        <div class="col-lg-10"><input type="password" placeholder="SecretKey"
                                                                      name="CosSk"
                                                                      class="form-control"
                                                                      value="{{sc "CosSk" "cos"}}">
                                        </div>
                                    </div>
                                    <div class="form-group row"><label
                                                class="col-lg-2 col-form-label">地域节点Region</label>
                                        <div class="col-lg-10"><input type="text" placeholder="所属地域 例如：ap-beijing"
                                                                      name="CosRegion"
                                                                      class="form-control"
                                                                      value="{{sc "CosRegion" "cos"}}">
                                        </div>
                                    </div>
                                    <div class="form-group row">
                                        <div class="col-lg-offset-2 col-lg-10">
                                            <button class="btn btn-sm btn-danger" type="button" id="cosInfo">修改
                                            </button>
                                        </div>
                                    </div>
                                </form>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="col-lg-5">
            <div class="row">
                <div class="col-lg-12">
                    <div class="ibox ">
                        <div class="ibox-title">
                            <h5>个人信息</h5>
                            <div class="ibox-tools">
                                <a class="collapse-link">
                                    <i class="fa fa-chevron-up"></i>
                                </a>
                                <a class="close-link">
                                    <i class="fa fa-times"></i>
                                </a>
                            </div>
                        </div>
                        <div class="ibox-content">
                            <form id="form-user">
                                <p>用户相关信息配置.</p>
                                <div class="form-group row"><label class="col-lg-2 col-form-label">账号</label>
                                    <div class="col-lg-10"><input type="text" placeholder="用户登陆账号" name="Author"
                                                                  class="form-control" value="{{sc "Author" ""}}">
                                    </div>
                                </div>
                                <div class="form-group row"><label class="col-lg-2 col-form-label">密码</label>
                                    <div class="col-lg-10"><input type="password" placeholder="用户登陆密码" name="Password"
                                                                  class="form-control" value="{{sc "Password" ""}}">
                                    </div>
                                </div>
                                <div class="form-group row">
                                    <div class="col-lg-offset-2 col-lg-10">
                                        <button class="btn btn-sm btn-danger" type="button" id="userInfo">修改</button>
                                    </div>
                                </div>
                            </form>
                        </div>
                    </div>
                </div>
                <div class="col-lg-12">
                    <div class="ibox ">
                        <div class="ibox-title">
                            <h5>七牛云配置</h5>
                            <div class="ibox-tools">
                                <a class="collapse-link">
                                    <i class="fa fa-chevron-up"></i>
                                </a>
                                <a class="close-link">
                                    <i class="fa fa-times"></i>
                                </a>
                            </div>
                        </div>
                        <div class="ibox-content">
                            <form id="form-qiniu">
                                <p>七牛云存储信息配置.</p>
                                <div class="form-group row"><label class="col-lg-2 col-form-label">AccessKey：</label>
                                    <div class="col-lg-10"><input type="text" placeholder="七牛云AK" name="QnAk"
                                                                  class="form-control"
                                                                  value="{{sc "QnAk" "qn"}}">
                                    </div>
                                </div>
                                <div class="form-group row"><label class="col-lg-2 col-form-label">SecretKey：</label>
                                    <div class="col-lg-10"><input type="password" placeholder="七牛云SK" name="QnSk"
                                                                  class="form-control"
                                                                  value="{{sc "QnSk" "qn"}}">
                                    </div>
                                </div>
                                <div class="form-group row"><label class="col-lg-2 col-form-label">Bucket：</label>
                                    <div class="col-lg-10"><input type="text" placeholder="空间Bucket" name="QnBucket"
                                                                  class="form-control" value="{{sc "QnBucket" "qn"}}">
                                    </div>
                                </div>
                                <div class="form-group row"><label class="col-lg-2 col-form-label">Zone：</label>

                                    <div class="col-lg-10">
                                        <select data-placeholder="请选择一个分类" name="Zone"
                                                class="chosen-select form-control"
                                                tabindex="2">
                                            <option></option>
                                            {{with $zone := sc "QnZone" "qn"}}
                                                {{if eq $zone "storage.ZoneHuadong"}}
                                                    <option value="storage.ZoneHuadong" selected>华东</option>
                                                    <option value="storage.ZoneHuabei">华北</option>
                                                    <option value="storage.ZoneHuanan">华南</option>
                                                    <option value="storage.ZoneBeimei">北美</option>
                                                {{else if eq $zone "storage.ZoneHuabei"}}
                                                    <option value="storage.ZoneHuadong">华东</option>
                                                    <option value="storage.ZoneHuabei" selected>华北</option>
                                                    <option value="storage.ZoneHuanan">华南</option>
                                                    <option value="storage.ZoneBeimei">北美</option>
                                                {{else if eq $zone "storage.ZoneHuanan"}}
                                                    <option value="storage.ZoneHuadong">华东</option>
                                                    <option value="storage.ZoneHuabei">华北</option>
                                                    <option value="storage.ZoneHuanan" selected>华南</option>
                                                    <option value="storage.ZoneBeimei">北美</option>
                                                {{else if eq $zone "storage.ZoneBeimei"}}
                                                    <option value="storage.ZoneHuadong">华东</option>
                                                    <option value="storage.ZoneHuabei">华北</option>
                                                    <option value="storage.ZoneHuanan">华南</option>
                                                    <option value="storage.ZoneBeimei" selected>北美</option>
                                                {{else}}
                                                    <option value="storage.ZoneHuadong" selected>华东</option>
                                                    <option value="storage.ZoneHuabei">华北</option>
                                                    <option value="storage.ZoneHuanan">华南</option>
                                                    <option value="storage.ZoneBeimei">北美</option>
                                                {{end}}
                                            {{end}}
                                        </select>
                                    </div>
                                </div>
                                <div class="form-group row">
                                    <div class="col-lg-offset-2 col-lg-10">
                                        <button class="btn btn-sm btn-danger" type="button" id="qiniuInfo">修改</button>
                                    </div>
                                </div>
                            </form>
                        </div>
                    </div>
                </div>

                <div class="col-lg-12">
                    <div class="ibox ">
                        <div class="ibox-title">
                            <h5>又拍云配置</h5>
                            <div class="ibox-tools">
                                <a class="collapse-link">
                                    <i class="fa fa-chevron-up"></i>
                                </a>
                                <a class="close-link">
                                    <i class="fa fa-times"></i>
                                </a>
                            </div>
                        </div>
                        <div class="ibox-content">
                            <form id="form-upyun">
                                <p>又拍云配置，请确保操作员有读写删除操作.</p>
                                <div class="form-group row"><label class="col-lg-2 col-form-label">服务名称</label>
                                    <div class="col-lg-10"><input type="text" placeholder="填写服务名称" name="UpBucket"
                                                                  class="form-control" value="{{sc "UpBucket" "up"}}">
                                    </div>
                                </div>
                                <div class="form-group row"><label class="col-lg-2 col-form-label">操作员</label>
                                    <div class="col-lg-10"><input type="text" placeholder="操作员名称" name="UpOperator"
                                                                  class="form-control"
                                                                  value="{{sc "UpOperator" "up"}}">
                                    </div>
                                </div>
                                <div class="form-group row"><label class="col-lg-2 col-form-label">操作员密码</label>
                                    <div class="col-lg-10"><input type="password" placeholder="操作员密码" name="UpPassword"
                                                                  class="form-control"
                                                                  value="{{sc "UpPassword" "up"}}">
                                    </div>
                                </div>
                                <div class="form-group row"><label class="col-lg-2 col-form-label">服务域名</label>
                                    <div class="col-lg-10"><input type="text" placeholder="用于生成完整的可访问链接"
                                                                  name="UpDomain"
                                                                  class="form-control" value="{{sc "UpDomain" "up"}}">
                                    </div>
                                </div>
                                <div class="form-group row">
                                    <div class="col-lg-offset-2 col-lg-10">
                                        <button class="btn btn-sm btn-danger" type="button" id="upyunInfo">修改</button>
                                    </div>
                                </div>
                            </form>
                        </div>
                    </div>
                </div>

            </div>
        </div>
    </div>
</div>
<!-- Chosen -->
<script src="/static/js/plugins/chosen/chosen.jquery.js"></script>
<!-- layer -->
<script src="/static/layer/layer.js"></script>
<script>
    $('.chosen-select').chosen({width: "100%"});
    $("#siteInfo").click(function () {
        const postData = $("#form-site").serialize();
        $.post("/api/site/config?submit=siteInfo", postData, function (res) {
            if (res.error === 0) {
                layer.open({
                    skin: 'layer-class',
                    title: res.title
                    , content: res.msg,
                    yes: function (index) {
                        window.location.href = "/admin/setting";
                    }
                });
            } else {
                layer.msg(res.title + res.msg, {time: 2000});
            }
        }, "json");
        return false;
    });
    $("#userInfo").click(function () {
        const postData = $("#form-user").serialize();
        $.post("/api/site/config?submit=userInfo", postData, function (res) {
            if (res.error === 0) {
                layer.open({
                    skin: 'layer-class',
                    title: res.title
                    , content: res.msg,
                    yes: function (index) {
                        window.location.href = "/admin/setting";
                    }
                });
            } else {
                layer.msg(res.title + res.msg, {
                    icon: 2,
                    shade: [0.8, '#393D49'], // 透明度  颜色
                    time: 2000
                });
            }
        }, "json");
        return false;
    });
    $("#qiniuInfo").click(function () {
        const postData = $("#form-qiniu").serialize();
        $.post("/api/site/config?submit=niniuInfo", postData, function (res) {
            if (res.error === 0) {
                layer.open({
                    skin: 'layer-class',
                    title: res.title
                    , content: res.msg,
                    yes: function (index) {
                        window.location.href = "/admin/setting";
                    }
                });
            } else {
                layer.msg(res.title + res.msg, {
                    icon: 2,
                    shade: [0.8, '#393D49'], // 透明度  颜色
                    time: 2000
                });
            }
        }, "json");
        return false;
    });
    $("#upyunInfo").click(function () {
        const postData = $("#form-upyun").serialize();
        $.post("/api/site/config?submit=upyunInfo", postData, function (res) {
            if (res.error === 0) {
                layer.open({
                    skin: 'layer-class',
                    title: res.title
                    , content: res.msg,
                    yes: function (index) {
                        window.location.href = "/admin/setting";
                    }
                });
            } else {
                layer.msg(res.title + res.msg, {
                    icon: 2,
                    shade: [0.8, '#393D49'], // 透明度  颜色
                    time: 2000
                });
            }
        }, "json");
        return false;
    });
    $("#ossInfo").click(function () {
        const postData = $("#form-oss").serialize();
        $.post("/api/site/config?submit=ossInfo", postData, function (res) {
            if (res.error === 0) {
                layer.open({
                    skin: 'layer-class',
                    title: res.title
                    , content: res.msg,
                    yes: function (index) {
                        window.location.href = "/admin/setting";
                    }
                });
            } else {
                layer.msg(res.title + res.msg, {
                    icon: 2,
                    shade: [0.8, '#393D49'], // 透明度  颜色
                    time: 2000
                });
            }
        }, "json");
        return false;
    });
    $("#cosInfo").click(function () {
        const postData = $("#form-cos").serialize();
        $.post("/api/site/config?submit=cosInfo", postData, function (res) {
            if (res.error === 0) {
                layer.open({
                    skin: 'layer-class',
                    title: res.title
                    , content: res.msg,
                    yes: function (index) {
                        window.location.href = "/admin/setting";
                    }
                });
            } else {
                layer.msg(res.title + res.msg, {
                    icon: 2,
                    shade: [0.8, '#393D49'], // 透明度  颜色
                    time: 2000
                });
            }
        }, "json");
        return false;
    });
</script>